package utils

import (
	"fmt"

	"github.com/aliyun/aliyun-oss-go-sdk/oss"
	"github.com/spf13/viper"
)

var OssClient *oss.Client

func InitOssClient() {
	var AccessKeyId = viper.GetString("oss.accessKeyId")
	var AccessKeySecret = viper.GetString("oss.accessKeySecret")
	// bucketName      = viper.GetString("oss.bucketName")
	var endpoint = viper.GetString("oss.endpoint")
	fmt.Printf("endpoint: %v\n", endpoint)
	fmt.Printf("AccessKeyId: %v\n", AccessKeyId)

	client, err := oss.New(endpoint, AccessKeyId, AccessKeySecret) // 创建OSSClient实例。
	if err != nil {
		panic(err)
	}
	OssClient = client
}
